package li;

public class demo4 {
	private int year,month,day;
	
	demo4(){
		year=2000;
		month=1;
		day=1;
		
	}
	demo4(int a,int b, int c){
		year=a;
		month=b;
		day=c;
		
	}
	demo4(demo4 d){
		year=d.year;
		month=d.month;
		day=d.day;
		
	}
	public void outData(){
		System.out.println(year+"/"+month+"/"+day);
		
		
	}
	public int daysInMonth(){
		
		
		switch(month){
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:return 31;
		case 2:if(year%4==0&&year%100!=0||year%400==0){
				return 29;
			
				}else{
					return 28;
				}
		default: return 30;
		
		
		}
	}
	
	public demo4 tomorrow(){
		demo4 d=new demo4(this);
		d.day++;
		if(d.day>d.daysInMonth()){
			d.day=1;
			d.month++;
			if(d.month>12){
				d.month=1;
				d.year++;
			}
			
		}
		
		return d;
				
	}
	
	public static void main(String args[]){
		demo4 d1=new demo4();
		System.out.println("The current date is(year/month/day):");
		d1.outData();
		System.out.println();
		System.out.println("Its tommorrow is(year/month/day)");
		d1.tomorrow().outData();
		
		demo4 d2=new demo4(2014,1,8);
		System.out.println("The current date is(year/month/day):");
		d2.outData();
		System.out.println();
		System.out.println("Its tommorrow is(year/month/day)");
		d2.tomorrow().outData();
		
	}
}


